//# sourceURL=http://uMapApp/Earth/DataSourceView/ImageryDataSourceView
define([
    "mhjs/mhjs",
    "uMap/uMap",
    "uEarth/uEarth",
    "./DataSourceView"
], function (
    mhjs,
    uMap,
    uEarth,
    DataSourceView
) {

    function ImageryDataSourceView(option) {

        var _this = this;
        DataSourceView.call(_this, option);

    }

    var _class = ImageryDataSourceView;

    mhjs.Inherit(_class, DataSourceView);

    Object.defineProperties(_class.prototype, {
        "open"        : {
            value: function () {

                var _this = this;

                if (!_this.isOpened) {

                    _this.imagery.object.show = true;
                    _this.isOpened = true;

                    this.trigger("open");
                    this.trigger("toggle");
                }
            }
        },
        "close"       : {
            value: function () {

                var _this = this;

                if (_this.isOpened) {

                    this.trigger("close");
                    this.trigger("toggle");

                }

                _this.imagery.object.show = false;
                _this.isOpened = false;
            }
        },
        "tilingScheme": {
            get: function () {
                return this._tilingScheme;
            },
            set: function (tilingScheme) {

                var _this = this;
                if (Number(tilingScheme) === 3857) {
                    _this._tilingScheme = new uEarth.WebMercatorTilingScheme();
                } else if (Number(tilingScheme) === 4326) {
                    _this._tilingScheme = new uEarth.GeographicTilingScheme();
                }
            }
        },
        "token"       : {
            get: function () {
                return this._token;
            },
            set: function (token) {
                var _this = this;
                _this._token = token;
                _this.url = _this.url + "&" + token.key + "=" + token.value;
            }
        }
    });

    return _class;

});